import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue'),
  },
  {
    path: '/',
    // name: 'layout',
    component: () => import('@/views/layout.vue'),
    children: [
      {
        path: '', // 默认子路由，只能有一个
        name: 'home',
        component: () => import('@/views/home.vue'),
      },
      {
        path: '/video',
        name: 'video',
        component: () => import('@/views/video.vue'),
      },
      {
        path: '/q&a',
        name: 'q&a',
        component: () => import('@/views/q&a.vue'),
      },
      {
        path: '/My',
        name: 'My',
        component: () => import('@/views/My.vue'),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
